#ifndef MENU_H_
#define MENU_H_

#include "stdint.h"
#include "modbus.h"
#include "main.h"

#define MENU_DELAY_LOGO_VISIBLE		1000

void MenuTask(void *pvParameters);

#define SUBMENU_MAX 30
#define KEY_DELAY	150

enum E_MENU_LANGUAGE
{
	E_MENU_LANGUAGE_ENG,
	E_MENU_LANGUAGE_RU,
	E_MENU_LANGUAGE_ALL = 2
};

enum E_MENU_TYPE_INPUT
{
	E_MENU_TYPE_INPUT_8,
	E_MENU_TYPE_INPUT_16,
	E_MENU_TYPE_INPUT_32,
	E_MENU_TYPE_INPUT_DateTime
};

enum eTypeMenuLCD
{
	E_MENU_TYPE_SUB,
	E_MENU_TYPE_EXE
};

enum eMenuStatus
{
	E_MENU_STATUS_UPDATE = 1
};

typedef struct sMenuLCD
{
	uint8_t type;
	uint8_t subMenuCount;
	const char* caption[E_MENU_LANGUAGE_ALL];
	void (*ExeFunc)(void);
	const struct sMenuLCD *submenu[SUBMENU_MAX];
}sMenuLCD;

enum E_MENU_NET_CUR_ACTION
{
	E_MENU_NET_CUR_ACTION_SELECT_GSM,
	E_MENU_NET_CUR_ACTION_SELECT_ETHERNET,
	// GSM
	E_MENU_NET_CUR_ACTION_GSM_GET_OPERATOR,
	E_MENU_NET_CUR_ACTION_GSM_GET_VALUE_RSSIO,
	E_MENU_NET_CUR_ACTION_GSM_OPEN_SOCKET,
	E_MENU_NET_CUR_ACTION_GSM_SEND_PACKET,
	E_MENU_NET_CUR_ACTION_GSM_CLOSE_SOCKET,
	E_MENU_NET_CUR_ACTION_GSM_INIT,
	// ETHERNET
	E_MENU_NET_CUR_ACTION_ETHERNET_GET_DHCP,
	E_MENU_NET_CUR_ACTION_ETHERNET_OPEN_SOCKET,
	E_MENU_NET_CUR_ACTION_ETHERNET_SEND_PACKET,
	E_MENU_NET_CUR_ACTION_ETHERNET_CLOSE_SOCKET,
};

typedef struct sMenuNavigationStruct
{
	uint8_t selectItem;
	uint8_t countStep;
	uint8_t language;
	uint8_t string[30];
	uint8_t status;
	sMenuLCD *lastMenu[SUBMENU_MAX];
}sMenuNavigationStruct;

typedef struct sMenuStruct
{
	sMenuNavigationStruct navigationStruct;
}sMenuContext;

extern sMenuContext menuContext;

#endif
